package com.qc31.monitorlib.clusters

import com.amap.api.maps.model.LatLng
import com.amap.api.maps.model.Marker
import com.qc31.monitorlib.clusters.ClusterItem

/** Created by yiyi.qi on 16/10/10. */
class Cluster internal constructor(val centerLatLng: LatLng) {

    private val mClusterItems: MutableList<ClusterItem>
    var marker: Marker? = null

    fun addClusterItem(clusterItem: ClusterItem) {
        mClusterItems.add(clusterItem)
    }

    fun removeClusterItem(clusterItem: ClusterItem) {
        for (item in mClusterItems) {
            if (clusterItem.carId == item.carId) {
                mClusterItems.remove(item)
                break
            }
        }
    }

    val clusterCount: Int
        get() = mClusterItems.size

    val clusterItems: List<ClusterItem>
        get() = mClusterItems

    init {
        mClusterItems = ArrayList()
    }
}